package pe.com.upc.edu.rtt.ultimoseventosfutbolisticos.controller;


import java.util.List;

import javax.portlet.RenderRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import pe.com.upc.edu.rtt.ultimoseventosfutbolisticos.bean.PartidoBean;
import pe.com.upc.edu.rtt.ultimoseventosfutbolisticos.service.ConsultarPartidosService;

import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.util.PropsUtil;

@Controller
@RequestMapping("VIEW")
public class UltimosEventosFutbolisticosController {
//
//	<liferay-ui:journal-article articleId="11827" groupId="<%= themeDisplay.getScopeGroupId() %>" />	
	private static final Log _log = LogFactoryUtil.getLog(UltimosEventosFutbolisticosController.class);
	
	@Autowired
	private ConsultarPartidosService consultarPartidosService;
	
	@RequestMapping
	protected String defaultView(Model model, RenderRequest renderRequest) throws SystemException {			
		if (_log.isDebugEnabled())
			_log.debug("UltimosEventosFutbolisticosController list2");
		List<PartidoBean> listaPartidoBeans = consultarPartidosService.obtenerListaPartidos();
		model.addAttribute("listaPartidoBeans", listaPartidoBeans);
		model.addAttribute("urlDetalle", PropsUtil.get("pagina.detalle.partido"));
		return "view";
	}
}
